*****************************Figure 1 TFP by industries*************************
use "${map}/fy1975"

*Fama-French 12 industries 
gen sich1=sich
replace sich1=sic if sich==.
ffind sich1, newvar(ffi12) type(12)


keep gvkey gvkey1 year sich1 sic ffi48 ffi12 tfp
*tfp raw data 
gen tfp_exp=exp(tfp)
*industry average tfp 
collapse (mean) tfp_exp, by ffi12 year
rename tfp_exp tfp_ffi12 

twoway (line tfp_ffi12 year if ffi12==3, sort lcolor(midblue)) (line tfp_ffi12 year if ffi12==4, sort lcolor(maroon)) (line tfp_ffi12 year if ffi12==6, sort lcolor(dkgreen)) (line tfp_ffi12 year if ffi12==9, sort lcolor(orange))



save "${map}/TFP figure/TFP_figure data.dta"



